import axios from "axios";
import { Dept } from "./type";

export const getTreeDepts = () => axios.get<Dept[]>('/system/dept/treeselect');
export const getDeptList = (parentId?: number) => axios.get<Dept[]>( '/system/dept/list', { params: { parentId } });
export const getDeptInfo = (id: number) => axios.get<Dept>(`/system/dept/${id}`);
export const addDept = (data: Partial<Dept>) => axios.post('/system/dept', data);
export const updateDept = (data: Partial<Dept>) => axios.put('/system/dept', data);
export const deleteDept = (id: number) => axios.delete(`/system/dept/${id}`);
export const changeStatus = (id: number, status: '0'|'1') => axios.put(`/system/dept/changeStatus`, { id, status });
